import axios from 'axios';
import {API_NEW_VERSION} from '../api';

var qs = require('qs');

const SERVICE_PROVIDERS = API_NEW_VERSION + 'service_providers';
const SERVICE_PROVIDERS_BY_ADDRESS = API_NEW_VERSION + 'service_providers_by_address';
const SERVICE_PROVIDER_MODIFY_STATUS = API_NEW_VERSION + 'service_provider_modify_status';
const SERVICE_PROVIDER_BY_ID = API_NEW_VERSION + 'service_provider_by/';

// 获取列表
export const searchServiceProvider = params => {
  return axios.get(SERVICE_PROVIDERS, {params: params});
};

export const searchServiceProviderByAddress = params => {
  return axios.get(SERVICE_PROVIDERS_BY_ADDRESS, {params: params});
};
// 保存
export const saveServiceProvider = (params) => {
  return axios.post(SERVICE_PROVIDERS, params);
};
export const resetStatus = (id, status) => {
  return axios.post(SERVICE_PROVIDER_MODIFY_STATUS, qs.stringify({id: id, status: status}));
};
// 批量删除
export const batchDel = (id) => {
  return axios.delete(SERVICE_PROVIDER_BY_ID + id);
};
